apply plugin: 'com.android.application'

import com.android.build.OutputFile
ext.versionCodes = ['armeabi-v7a':1, 'arm64-v8a':2, 'mips':3, 'x86':4, 'x86_64':5]

android {
	compileSdkVersion 29
	ndkVersion '21.0.6113669'

	defaultConfig {
		applicationId 'com.company.appname'
		minSdkVersion 18
		targetSdkVersion 29
		versionCode  1
		versionName  "1.0.0"
	}
	buildTypes {
		release {
			minifyEnabled false
			proguardFiles getDefaultProguardFile('proguard-android.txt'),
						  'proguard-rules.pro'
		}
	}
	externalNativeBuild {
		cmake {
			version '3.10.2'
			path 'src/main/cpp/CMakeLists.txt'
		}
	}
	splits {
		abi {
			enable true
			reset()
			include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
			universalApk true
		}
	}

	applicationVariants.all { variant ->
		// assign different version code for each output
		variant.outputs.each { output ->
			if (output.getFilter(OutputFile.ABI) == null) {
				output.versionCodeOverride = defaultConfig.versionCode
			}
			else {
				output.versionCodeOverride =
					project.ext.versionCodes.get(output.getFilter(OutputFile.ABI)) * 100000000 +
								defaultConfig.versionCode
			}
		}
	}
}

